<h3>Hypermedia representations</h3>

<p>A Restful application should support hypermedia content, and following this constraint, a typical resource representing an order in xml would add controls (links or forms) so clients can navigate through your service protocol (in this case, make a payment):</p>

<pre>
	<%= html '
<order xmlns:atom="http://www.w3.org/2005/Atom">
	<product>rails training</product>
	<product>REST training</product>
	<price>512.45</price>
	<atom:link rel="self" href="http://www.caelum.com.br/orders/1" />
	<atom:link rel="payment" href="http://www.caelum.com.br/orders/1/payment" />
</order>
'%>
</pre>

Here the order is represented through a typical application/xml file, but it has something extra: controls that allows clients to decide what to do next.
Or an <b>example</b> of a valid json representation with hypermedia:

<pre>
{ "order" : {
		"product" : "rails training",
		"product" : "rest training",
		"price" : "512.45"
		"links" : {
			"link" : { "rel" : "self", "href" : "http://www.caelum.com.br/orders/1"},
			"link" : { "rel" : "payment", "href" : "http://www.caelum.com.br/orders/1/payment"}
		}
	}
}
</pre>

Last of all, one could add the links on the Link header of the http response:

<pre>
<%= html 'Link: <http://www.caelum.com.br/orders/1>; rel="self", <http://www.caelum.com.br/orders/1/payment>; rel="payment"' %>
</pre>
